package cn.mw.cmdb.view;

import cn.mw.cmdb.entity.FieldAuthType;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;

import java.io.Serializable;
import java.util.Map;
import java.util.Set;

@Data
public class InstanceInputFieldView implements Serializable {
    private String id;
    private String label;
    private String propertyType;
    private Object defaultValue;
    private Object value;

    @JsonIgnore
    private Map<String, Object> context;
    //字段权限
    private Set<FieldAuthType> fieldAuthTypes;

    //数据提取
    public Object getValue(Map data){
        Object value = data.get(id);
        if(null == value){
            value = data.get(label);
        }
        return value;
    }

}
